package edu.ccut.saturn.component.impl.directory;

import java.net.URL;

import org.osgi.framework.Bundle;

import edu.ccut.saturn.component.ComponentFactory;
import edu.ccut.saturn.component.IBundleInfo;
import edu.ccut.saturn.component.SaturnComponentException;

public class FilterConfigFileResourceInfo extends AbstractFileResourceInfo {

	public FilterConfigFileResourceInfo() {
		super(SATURN_CONFIG_NAME_Filter);
	}

	@Override
	public void load(Bundle bundle, IBundleInfo bundleInfo) {
		URL url = bundle.getEntry(this.getFilePath());
		try {
			bundleInfo.getBundleFilterInfo().initSaturnBundleFilterInfo(
					ComponentFactory.getSaturnBundleFilterInfo(bundle, url));
		} catch (SaturnComponentException e) {
			logger.error("load filter config file failed! the file name is \""
					+ this.getFilePath() + "\" in bundle ["
					+ bundle.getSymbolicName() + "]", e);
		}
	}
}
